1bashThis demonstrates string comparison using == and != to check if the current user is "foo" or "bar".## equal test if [[ "foo" == "$USER" ]]; then echo "user is foo" else echo "user is not foo" fi ## not equal test if [[ "bar" != "$USER" ]]; then echo "user is not bar" else echo "user is bar" fibash internalflow controltests (conditions)string condition
2bashThis demonstrates checking if a string is empty or not using conditional expressions.if [[ -z "$string" ]]; then echo "String is empty" elif [[ -n "$string" ]]; then echo "String is not empty" fibash internalflow controltests (conditions)string condition
3bashThis demonstrates how to check if a string is empty using the -z conditional expression in Bash.[[ -z STRING ]]bash internalflow controltests (conditions)string condition
4bashThis demonstrates checking if a string is non-empty using the -n condition in Bash.[[ -n STRING ]]bash internalflow controltests (conditions)string condition
5bashThis demonstrates basic string comparison using double square brackets [[ ]] in Bash.[[ STRING == STRING ]]bash internalflow controltests (conditions)string condition
6bashThis demonstrates string comparison in Bash.if [[ "$name" == "Daniya" ]] || [[ "$name" == "Zach" ]]; then echo "This will run if $name is Daniya OR Zach." fibash internalflow controltests (conditions)string condition
7bashThis demonstrates string comparison in Bash using the == operator.# Equal [[ "$A" == "$B" ]]bash internalflow controltests (conditions)string condition
8bashThis demonstrates string inequality comparison using [[ ... ]] in Bash.[[ STRING != STRING ]]bash internalflow controltests (conditions)string condition
9bashThis demonstrates checking if a string is empty or not using -z and -n operators in a Bash conditional statement.# String if [[ -z "$string" ]]; then echo "String is empty" elif [[ -n "$string" ]]; then echo "String is not empty" else echo "This never happens" fibash internalflow controltests (conditions)string condition
10bashThis demonstrates a basic conditional check to compare a variable with the current user's username.if [[ "$name" != "$USER" ]]; then echo "Your name isn't your username" else echo "Your name is your username" fibash internalflow controltests (conditions)string condition